package com.yin;

import com.yin.verify.Permission;
import com.yin.verify.User;
import com.yin.verify.Verify;

public class Session {
	
	private static User user = null;
	private static Session session = new Session();
	
	private Session() {}
	
	public static boolean login() {
		
		User verifyUser = Verify.verify();
		if(verifyUser != null) {
			user = verifyUser;
			Yin.session = session;
			return true;
		} else {
			user = null;
			Yin.session = null;
			return false;
		}
		
	}
	
	public static void logout() {
		user = null;
		Yin.session = null;
	}
	
	public static String getUsername() {
		return user.username;
	}
	
	public static String getHwid() {
		return user.hwid;
	}
	
	public static Permission getPermission() {
		return user.permission;
	}
}
